<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', function()
{
	return View::make('index');
});

Route::group(array('prefix' => 'api'), function() {

    // 评论路由，并不需要前台编辑
    Route::resource('comments', 'CommentController',
        array('only' => array('index', 'store', 'destroy')));
});


//用户登陆注册
Route::group(array('prefix' => 'auth'), function () {
    $Auth = 'AuthController@';
    # 登录
    Route::get('login', array('as' => 'login' , 'uses' => $Auth.'getLogin'));
    Route::post('login', $Auth.'postLogin');
    # 退出
    Route::get('logout', array('as' => 'logout', 'uses' => $Auth.'getLogout'));
    # 注册
    Route::get( 'signup', array('as' => 'signup' , 'uses' => $Auth.'getSignup'));
    Route::post('signup', $Auth.'postSignup');
});

// 需要登录的路由
Route::group(array('prefix' => '/admin', 'before' => 'auth|admin'), function(){
    //backend
    Route::get('/', '\\Backend\\HomeController@index');

});
